Soundcode in Jizz, Stash or Erratic
By Salami/Nothing^Ethos9
All these Intros use mxmplay by pascal.
1, Calculate a few samples and save them as 8bit .raw. Load the samples in FT2 and track the module. When it's finished, copy the module into two files, Min.xm and Max.xm. Now load Min.xm first and for each sample, set Range all and Volume 0, then save it. Then load Max.xm and set Volume max. Then convert with xm2mxm. Attention! Do not use Deltapacking! (xm2mxm demo.xm -d) Convert the files with bin2db32 to min.inc and max.inc. Now you can compare the two files, see where the samples start and easily cut the samples with the MS-DOS-Editor.
2, Plug the cut module in. Attention, remove everything from min.inc and max.inc except DB... no header!
; mod.asm - start
.386
.model flat,prolog
.data
public _mxm_modul
_mxm_modul label byte
include min.inc ; i assume that min.inc was cut, but
; that can also be max.inc :>
end
; mod.asm - ende
// external.h - start
extern "C"
{
extern char mxm_modul[];
}
unsigned char mxmmem[0x4000]; // memory for the playercode
3, OK, now as we have embedded our module, we have to allocate memory (sizeof(min.inc)+sizeof(calculated_samples)). There are two things that I can recommend you: Submissive's tiny heap or, better, a static array. Now we copy the cut module into our empty array or our allocated memory.
char our_module[1024*1024]; // 1 megabyte :>
void calc_samples()
{
static int offset=0;
memcpy(our_module,mxm_modul,gr”sse_des_beschnittenen_moduls);
offset=7+groesse_des_beschnittenen_moduls; // start_offset :>
// here comes your sample-code :>
our_module[offset++]=Signal;
}
void main()
{
xmpInit(our_module, xmpGetGUSPort(xmpGetEnvPtrDPMI(_psp)),
mxmmem, 65536, MXMINTMODEDOS);
xmpPlay(0);
getkey();
xmpStop();
}
4, The last kick is the -mp4 option like in Jizz :> Just save the array our_module. Since mxmplay supports the GUS only, it is important to check whether the samples have been calculated correctly, if you have no GUS.
h = create("test.mxm");
h = open ("test.mxm", OPEN_WRITEMODE);
write(h, 1024*1024, our_module); // 1024*1024 = 1MB
close(h);
5, OK, to be continued in the next Hugi :> If you have problems, you can find me on #coders (IRCNet).
Bye, and have fun Salami ^Nothing^Ethos9
Many, many many thanks to QUAD, TBL, and everyone who helped me writing my Samplegen :> I attached the converter "MXM to XM converter v1.00" by Brix / Dilemma and bin2asm by Peter Quiring because they are very hard to find on the net :>